// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod tray;
mod file_controller;
mod udp_controller;

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_fs::init())
        .plugin(tauri_plugin_sql::Builder::new().build())
        .plugin(tauri_plugin_dialog::init())
        .invoke_handler(tauri::generate_handler![
            file_controller::upload_file,
            file_controller::get_file_stream,
            file_controller::get_file_url,
            file_controller::list_upload_files,
            file_controller::save_file_with_dialog,
            file_controller::save_template_file,
            file_controller::get_machine_id,
            file_controller::read_auth_file,
            file_controller::write_auth_file,
            udp_controller::play_scene,
            udp_controller::stop_playing
        ])
        .setup(|app| {
            #[cfg(all(desktop))]
            {
                let handle = app.handle();
                tray::create_tray(handle)?;
            }
            Ok(())
        })
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
    // xplk_lib::run()
}
